<include file="Public/header" />
<div class="row">
  <div class="col-md-12">
    <form class="layui-form" id="editForm">
      <div class="layui-form-item">
        <label class="layui-form-label">角色名称：</label>
        <div class="layui-input-inline">
          <input type="text" name="title" value="<{$group_info.title}>" lay-verify="required" placeholder="请输入角色名称" autocomplete="off"  id="title" class="layui-input">
          <input type="hidden" name="id" value="<{$group_info.id}>" />
        </div>
      </div>

      <div class="layui-form-item">
        <div class="layui-input-block">
          <button class="layui-btn" lay-submit lay-filter="user">立即提交</button>
          <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
      </div>
    </form>
  </div>
</div>
<include file="Public/footer"/>
<script>
    layui.use('form', function(){
        var form = layui.form,
            $ = layui.jquery;
        $("button[type=reset]").click();
        //监听提交
        form.on('submit(user)', function(data){
            $.ajax({
                url:"<{:U('Auth/editGroup')}>",
                type:"post",
                data:$('#editForm').serialize(),
                success:function(res){
                    if(res.status){
                        layer.alert("操作成功", {icon: 6},function () {
                            parent.location.reload();
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                        });
                    }else{
                        layer.msg(res.msg ? res.msng : "操作失败!", {icon: 5},function () {
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                        });
                        return false;
                    }
                }
            });
            return false;//阻止表单跳转
        });
    });
</script>
</body>
</html>